import java.util.Scanner;

public class Number {
    public static void main(String[] args) {
        int max=101,min=0;
        int ran=(int) (Math.random()*(max-min)+min);
        System.out.println("欢迎体验猜数小游戏");
        System.out.println("猜谜数字范围0-100");
        for (int i = 7; i > 0; i--) {
            System.out.println("==请输入您的答案==");
            Scanner scanner = new Scanner(System.in);
            int num = scanner.nextInt();
            if(num>100||num<0){
                System.out.println("您输入的数超出范围");
            }
            else if (num==ran){
                System.out.println("恭喜您猜对了！！！");
                break;
            }else if (num>ran){
                System.out.println("您猜的数有点大了");
            }else if (num<ran){
                System.out.println("您猜的数有点小了");
            }
            System.out.println("您还有"+(i-1)+"次机会");
        }
    }
}
